Tmux will skyrocket your productivity — here's how

typecraft
8 Mar 202410:02

Summary

TLDRこの動画は、ターミナルマルチプレクサーであるt-mo(tmux)の使い方とその利点を紹介しています。t-moを使うことで、一つのウィンドウから複数のターミナルセッションを管理し、ウィンドウやペインを分割・結合することができ、作業の効率を大幅に向上させることができます。また、セッションを切断してもプロセスは継続して実行され、後で再接続することで、作業を中断せずに継続できます。動画では、t-moの基本操作や機能、そしてカスタマイズ方法についても触れています。

Takeaways

  • 🌟 t-mo(ターミナルマルチプレクサー)は、1つのウィンドウから複数のターミナルセッションを管理できるツールです。
  • 🔄 t-moを使えば、水平または垂直にペインを分割し、複数のウィンドウを作成できます。
  • 🔗 t-moはセッションを分割し、異なるプログラムを同時に実行することができ、生産性に役立ちます。
  • 🔄 t-moセッションを切断しても、後で再接続して作業を続けることができます。
  • 🔄 t-moはバックグラウンドで実行されるため、切断してもプロセスは継続します。
  • 🔄 t-moのセッションは、異なるターミナルやSSHセッションから復元できます。
  • 📝 t-moのコマンドモードでは、ウィンドウやセッションの名前を変更できます。
  • 🔄 t-moのセッションは、`t-mo ls`コマンドで一覧表示し、`t-mo attach`で再接続できます。
  • 📝 t-moのキーバインドはカスタマイズ可能で、より使いやすい設定に変更できます。
  • 🎥 このビデオでは、t-moの使い方と機能を紹介し、次回のビデオではt-moの外観を改善する方法を紹介します。
  • 🚀 t-moは開発者やDevOpsエンジニアなど、ターミナルを多く使用する人にとって超能力のような存在です。

Q & A

  • t-moは何ですか?

    -t-moはターミナル・マルチプレクサー(terminal multiplexer)で、一つのウィンドウから複数のターミナル・セッションを管理できるツールです。

  • t-moを使うことで得られる主な利点は何ですか?

    -t-moを使うことで、セッションの永続性、セッション共有、複数のウィンドウとペインの作成、そして生産性の向上が得られます。

  • t-moで新しいウィンドウを作成するにはどうすればいいですか?

    -t-moで新しいウィンドウを作成するには、コントロールキー(Ctrl)とBを同時に押した後にCを押す必要があります。

  • t-moでウィンドウを切り替えたい場合はどうすればいいですか?

    -t-moでウィンドウを切り替えるには、コントロールキー(Ctrl)とBを同時に押した後に、切り替えたいウィンドウの番号を押します。

  • t-moでペインを分割するにはどうすればいいですか?

    -t-moでペインを分割するには、コントロールキー(Ctrl)とBを同時に押した後に、水平分割はPを、垂直分割は二重引用符(Double quote)を押します。

  • t-moでペインを移動するにはどうすればいいですか?

    -t-moでペインを移動するには、コントロールキー(Ctrl)とBを同時に押した後に、上下左右の矢印キーを使って移動します。

  • t-moでウィンドウの名前を変更するにはどうすればいいですか?

    -t-moでウィンドウの名前を変更するには、コントロールキー(Ctrl)とBを同時に押した後にコマンドモードに入り、rename-windowコマンドを使って名前を変更します。

  • t-moのセッションを切断するにはどうすればいいですか?

    -t-moのセッションを切断するには、コントロールキー(Ctrl)とDを同時に押す必要があります。

  • t-moのセッションを再接続するにはどうすればいいですか?

    -t-moのセッションを再接続するには、t-mo attachコマンドを使って切断したセッションに再接続します。

  • t-moでセッションの名前を変更するにはどうすればいいですか?

    -t-moでセッションの名前を変更するには、コントロールキー(Ctrl)とBを同時に押した後にコマンドモードに入り、rename-sessionコマンドを使って名前を変更します。

  • t-moのセッションを一覧表示するにはどうすればいいですか?

    -t-moのセッションを一覧表示するには、t-mo lsコマンドを使ってすべてのセッションを表示します。

Outlines

00:00

🛠️ ターミナルマルチプレクサー t-moの紹介

この段落では、t-moというターミナルマルチプレクサーの機能と利点を紹介しています。t-moは、一つのウィンドウから複数のターミナルセッションを管理できるツールで、水平・垂直に分割されたペインを作成し、異なるセッション間を簡単に切り替えることができます。また、t-moをデタッチしても、実行中のプロセスはバックグラウンドで継続し、後で再接続することで直前の状態に戻ることができます。この機能は、開発者やDevOpsエンジニアにとって非常に便利な超能力です。

05:00

🔍 t-moの使い方と機能の詳細

この段落では、t-moの使い方と機能について詳しく説明しています。まず、t-moを起動すると、緑色のバーが表示され、これはt-moが動作していることを示しています。新しいウィンドウを作成したり、ペインを分割したり、ペイン間を移動したりすることができます。また、ウィンドウやセッションをリネームしたり、セッションを切断して再接続したりすることもできます。これらの機能は、複数のターミナルを効率的に管理し、生産性を向上させるために役立ちます。

Mindmap

Keywords

💡t-mo

t-moはターミナルマルチプレクサーで、複数のターミナルセッションを一つのウィンドウから管理できるツールです。このビデオでは、t-moの使い方や機能を紹介し、開発者やDevOpsエンジニアがターミナルでの作業を効率化する方法を学ぶことができます。例えば、t-moを使うことで、複数のタスクを同時に実行し、セッションを切断しても後で再接続して作業を継続できます。

💡CLI tools

CLIツールは、コマンドラインインターフェースを通じて操作するソフトウェアツールのことで、ターミナルでの作業に欠かせません。このビデオでは、t-moを使ってCLIツールをより効率的に管理する方法が説明されています。

💡DevOps

DevOpsは、開発(Development)と运维(Operations)を組み合わせた文化や実践であり、ソフトウェア開発とIT運用の間の連携を強化することを目的としています。このビデオでは、DevOpsエンジニアがt-moを使ってパイプラインワークフローを管理する方法が紹介されています。

💡session persistence

セッションの永続性とは、t-moセッションを切断しても、後で再接続して作業を継続できる機能です。これにより、ユーザーは作業を中断せずに他のタスクを行ったり、遠隔地のコンピュータにSSH接続してから再開することができます。

💡session sharing

セッション共有は、複数のユーザーが同じt-moセッションを使用できる機能です。これにより、プログラマーがペアプログラミングを行うことができます。このビデオでは、t-moのセッション共有機能が触れられています。

💡window and panes

t-moでは、ウィンドウとペインを分割して複数のタスクを同時に管理することができます。ウィンドウは独立した作業領域を提供し、ペインはウィンドウ内での垂直または水平分割です。この機能は、複数のターミナルプログラムを使い分ける際に生産性を向上させます。

💡leader key

リーダーキーは、t-moで特別なコマンドを実行するために使用されるキーの組み合わせです。例えば、Ctrl+Bを使用して新しいウィンドウを作成したり、セッションを切り替えたりすることができます。このビデオでは、リーダーキーの使用方法が詳細に説明されています。

💡detach and reattach

切断と再接続は、t-moの重要な機能で、ユーザーがセッションを一時的に切断して後で再接続して作業を継続できます。これは、長期的なプロセスを実行中にユーザーが他のタスクを行ったり、遠隔地のコンピュータにアクセスしたりする際に非常に便利です。

💡renaming windows and sessions

t-moでは、ウィンドウとセッションをリネームして、管理や識別を容易にすることができます。これは、複数のウィンドウやセッションを扱う際に、特定のタスクや内容を簡単に識別できるようになります。

💡configuration

t-moの設定は、ユーザーがキーバインドや外観をカスタマイズすることで、より効率的な作業環境を構築できます。このビデオでは、基本設定から始めて、後ほどのビデオでより高度な設定方法が紹介されています。

Highlights

t-mo (tmux) is a terminal multiplexer that allows multiple terminal sessions from one window.

t-mo enables splitting panes horizontally and vertically, enhancing productivity for developers and devops personnel.

With t-mo, users can run long processes and detach from the terminal, then reattach later to find the process still running.

t-mo provides persistence, allowing users to start a session, detach, and reattach later to the same session.

Session sharing is possible with t-mo, enabling multiple users to work on the same session, which is useful for pair programming.

t-mo allows users to create new windows and panes, and navigate between them efficiently.

Renaming windows in t-mo is straightforward, using the command mode with the 'rename-window' command.

Detaching from a t-mo session can be done with the 'detach' command (Ctrl+B then 'd'), and reattaching is done with 't-mo attach'.

t-mo sessions can be listed with 't-mo ls', and users can switch between them using the 'switch-session' command.

t-mo's default configuration is functional but can be improved with custom key bindings and settings.

The speaker plans to create a mini course on t-mo, starting with an introduction to its benefits and features.

The video series will also cover how to make t-mo look more aesthetically pleasing and improve key bindings for better usability.

The speaker emphasizes t-mo as a superpower for the terminal, significantly boosting productivity for those who use it effectively.

The video aims to show how t-mo can be integrated into a daily workflow to maximize terminal efficiency.

The speaker's enthusiasm for t-mo is evident, as they share their personal experiences and tips for using it effectively.

The video includes a demonstration of t-mo's basic functionality and how to get started with the tool.

Transcripts

play00:00

let's say you're developer and you're

play00:01

working in Vim or neov and you have a

play00:03

lot of CLI tools and you're doing a lot

play00:04

of stuff in the terminal or you're a

play00:06

devops person and you're tailing logs

play00:08

you're pushing the latest build to

play00:09

production and you're working on your

play00:10

pipeline workflows if you're doing a lot

play00:12

of work in the terminal and you're not

play00:14

using t-mo you're missing out let me

play00:17

show you what I'm talking about t-mo

play00:18

allows me to have multiple terminal

play00:20

sessions from one window I can split

play00:22

panes horizontally and vertically and I

play00:25

can create whole new windows I can then

play00:27

cycle in between these windows and panes

play00:30

really easily but what's awesome is I

play00:32

can do cool stuff like run my servers

play00:35

and tail something or run a long running

play00:37

process like let's say I pin google.com

play00:39

and I want to see what happens I don't

play00:41

know maybe it's going to go down who

play00:42

knows if I detach from my terminal and

play00:44

go do something else I can reattach to

play00:47

t-o and my stuff is still running t-mo

play00:50

is a superpow and I'm going to show you

play00:52

how it works let's get into

play00:54

[Music]

play00:58

it

play01:02

[Music]

play01:04

now I think t-mo is unbelievable and

play01:06

it's kind of a superpower for the

play01:08

terminal and if you're an aspiring neck

play01:09

beard like me you should learn it in

play01:11

fact I think it's so important I'm going

play01:13

to make a little mini course on t-u

play01:15

starting with this video right now this

play01:16

is episode one we're going to talk about

play01:18

why t-mo is great we're going to talk

play01:20

about how it works and we're going to

play01:21

show off some of its features and

play01:23

functionality in the next video I'm

play01:24

going to show you how to make t-u look

play01:26

beautiful that's right the t-u session

play01:28

you saw on the screen before this that's

play01:30

not how t-mo looks but we'll get there

play01:32

and then finally I'm going to show you

play01:33

how I use it in my day-to-day workflow

play01:35

to get the absolute best productivity

play01:37

out of my terminal it seriously is

play01:39

amazing and I'm excited to show you but

play01:41

first let's talk about

play01:43

t-mo what the hell is it well it's a

play01:47

terminal

play01:48

multiplexer okay got it no all right

play01:50

well let me show you now let's say

play01:52

you're a user using a

play01:55

computer this is me by the

play01:58

way to

play02:00

that's me nice to meet you now if I want

play02:03

to log into my terminal typically what

play02:05

you have is a single pseudo login to one

play02:09

terminal instance at a given point in

play02:13

time we'll call this

play02:17

pseudo

play02:19

login so basically if you want to open

play02:22

another login to a terminal you have to

play02:24

open a new window or a new

play02:28

tab is your terminal and it's a on toone

play02:31

relationship okay but now what if you're

play02:33

using t-o well t-o allows you to do

play02:35

something a little bit different here

play02:36

let's say you're the

play02:38

user with

play02:40

t-o you are allowed to have

play02:43

multiple pseudo terminal

play02:46

logins tied to just one terminal

play02:52

session so this is how t-mo works you

play02:55

get multiple terminal logins for one

play02:58

user tied to a single single controlling

play03:00

window it is a multiplexer or MX for

play03:04

short and it's for the terminal so it's

play03:08

t-mo that's where the name comes from

play03:10

and that's essentially how it works and

play03:12

this gives you a lot of cool things but

play03:14

one of the best aspects is you can sever

play03:17

the tie from the controlling window and

play03:19

then at any other point you can log in

play03:21

to another terminal maybe it's a

play03:23

different terminal session maybe your

play03:25

SSH somewhere and you can restore this

play03:28

whole entire session

play03:30

because t-o is running in the background

play03:32

on whatever computer is running t-mo so

play03:35

that's just a highle overview of how

play03:36

t-mo works and how I use it in my

play03:38

day-to-day so in short just to summarize

play03:41

t-o has a lot of benefits over using

play03:43

just your terminal number one you have

play03:45

persistence which means that you can

play03:47

start a teamu session detach do

play03:49

something else maybe you're working on

play03:51

something different or you go home and

play03:53

then SSH back into your work computer

play03:55

when you open up t-u again that session

play03:57

is still there it persists number number

play03:59

two you get session sharing which isn't

play04:01

something we covered and it's not

play04:02

something I'm going to cover but

play04:04

essentially you can have t-o set up so

play04:06

that multiple users can use the same

play04:08

t-mo session allowing you to pair

play04:10

program if you're a programmer funny

play04:12

story I did this at a job once and it

play04:13

worked pretty well and number three you

play04:15

have multiple windows and I would also

play04:18

add and

play04:20

panes as you saw in the intro you can

play04:23

split your windows you can split your

play04:24

panes you can create new windows it's a

play04:27

great experience for productivity if

play04:29

you're using a lot of different terminal

play04:30

programs okay so uh enough chitchat

play04:33

let's show t-mo off and kind of go over

play04:35

some of the features I use on a daily

play04:38

basis as a daily t-mo user now this is

play04:40

the base t-mo config there's no extra

play04:42

configuration here so it's going to look

play04:44

a little bit different than the intro

play04:45

and the key bindings are going to be

play04:46

different we'll go over better key

play04:48

bindings in a future video but this is

play04:49

what you'll get out of the box so all we

play04:51

have to type to start t-o is you guessed

play04:54

it t-mo now this drops us into a

play04:56

multiplexed terminal and you can tell

play04:58

because there's this little green bar at

play05:00

the bottom here that's t-mo running it

play05:02

shows off some interesting information

play05:04

like what window you're on what program

play05:05

you're currently running the user the

play05:07

time there's a lot of configuration you

play05:08

can do there as well so now we're in t-o

play05:10

uh we can do a few things we can create

play05:12

a new window and by doing that we want

play05:14

to push the leader button now what's the

play05:15

leader button it is contrl B so contrl b

play05:19

c will create a new window and we can

play05:21

tell that we created a new window

play05:23

because there is another entry in our

play05:25

little green bar at the bottom here now

play05:26

we can go back to our previous window by

play05:28

typing control B n now that switches the

play05:31

window that you're currently at you can

play05:32

also type contrl B and the number of the

play05:35

window that you want to switch to now

play05:37

you can see there's a little asteris

play05:38

icon so you can tell that I'm on window

play05:41

zero if I want to go to window one crl

play05:43

B1 if I want to go to window Z control

play05:46

b0 crl BN we'll cycle through them crl

play05:49

BN crl BN and there you go those are two

play05:52

windows now in this window I can split

play05:54

it to be different panes if I want to

play05:56

split it horizontally it's control B PR

play06:00

that is a horizontal split or is that

play06:01

vertical I can't tell anymore now if I

play06:03

want to split this paint again

play06:04

vertically I can do contrl B Double

play06:07

quote that's what's it vertically now to

play06:10

cycle through my panes I can do contrl B

play06:12

up to go up and left to go left arrows

play06:15

to go in whatever Direction you want so

play06:16

it's lader Arrow lader Arrow lader down

play06:21

lader up lader left and so that's how

play06:24

you create Windows panes and navigate

play06:27

between all of them but what if you have

play06:29

multiple windows open and you want to

play06:30

rename them well that's pretty easy too

play06:32

control B colon gets you into command

play06:34

mode in t-mo now that you're in command

play06:37

mode you can type things like rename

play06:39

window and then you can type the name of

play06:40

your new window let's just call it poop

play06:43

so now you can see our window name has

play06:45

been updated to poop pretty sweet so

play06:47

let's say I'm doing something else and I

play06:48

want to detach from t-mo that is leader

play06:51

d d for detach now you can see I've

play06:53

detached from session zero okay awesome

play06:56

how do I reattach well there's a couple

play06:58

things you can do first if you want to

play07:00

just see the list of sessions you can do

play07:02

t-mo LS that will list all the sessions

play07:04

that you currently have open in t-mo

play07:07

pretty neat next if you want to reattach

play07:09

to your previous session you do t-mo

play07:11

attach there you go now your session's

play07:14

back you can see that our window still

play07:15

has that poop name on it and we're

play07:17

looking pretty good so talking about

play07:19

sessions now how do you create another

play07:21

session in t-mo well let me detach from

play07:25

t-o and then just type t-mo again that

play07:28

will create a whole new session for you

play07:30

you can see that there's no windows no

play07:32

panes and it's just a blank t-mo

play07:34

instance so this is cool and all but

play07:37

what if I want to get back to my

play07:38

previous session well from within t-o

play07:40

it's actually really simple leader s

play07:43

will list all the sessions currently

play07:44

open in t-o then you can go up and down

play07:47

to navigate between them and we can see

play07:49

that our previous session uh zero has

play07:52

all of our pains and windows and so we

play07:54

can hit enter to select that one and

play07:56

we're back in but the session list isn't

play07:58

very easy to understand how do we rename

play08:01

sessions well through the command line

play08:04

we can do leader colon and type rename

play08:08

session and we'll call this one the poop

play08:10

session just because we named one of our

play08:12

Windows poop it seems

play08:15

fitting so now if we list all of our

play08:17

sessions we see poop sessions up top and

play08:19

then our unnamed new session that we

play08:21

created that's kind of blank is at the

play08:23

bottom so now it's easier to understand

play08:26

where your sessions are so then again

play08:27

now if I detach from this session and

play08:30

type t-mo LS we see that we have two

play08:33

sessions I can now reattach to my last

play08:36

t-mo session and that's not the one I

play08:38

want so I can just switch it to go to

play08:39

poop session now if I do a long running

play08:42

process like pinging google.com let's

play08:44

say or let's say you're tailing logs at

play08:46

work and you have to leave and go home

play08:49

and then maybe SSH into a remote machine

play08:51

or whatever you can just detach from the

play08:54

session go do whatever else you know you

play08:56

can quit this terminal actually you know

play08:58

yeah so my terminal has been quit I can

play09:00

reopen iterm and then if I type t-mo

play09:03

attach there I am I'm reattached to my

play09:05

last session which was of course poop

play09:08

session and my ping is still running

play09:10

t-mo has been running in the background

play09:12

this whole time so that when I reattach

play09:14

I'm really just opening the window that

play09:16

was previously closed and everything

play09:18

within it has been running pretty

play09:19

awesome also all my sessions are still

play09:21

here so in this video we went over a

play09:24

little bit about how t-o works why maybe

play09:26

you would want to use it and some of the

play09:28

benefits you get from it and then we

play09:30

went over exactly what you can do to get

play09:32

a great workflow from t-mo but it's not

play09:35

properly configured I mean out of the

play09:37

box it's fine you get all the features

play09:39

and functionality but we can do a lot

play09:41

better so in the next video I'm going to

play09:42

show you how to make t-u look amazing

play09:44

and have much more sane key bindings and

play09:47

defaults so stick around and

play09:49

subscribe and hey thanks

play09:53

[Music]

play09:58

nerds

Rate This

5.0 / 5 (0 votes)

Related Tags
t-moターミナルマルチプレクサー生産性開発者DevOpsCLIツールセッション共有プログラミングSSHチュートリアル
Do you need a summary in English?